import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttachVO, AttachForm, AttachQuery } from '@/api/system/attach/types';

/**
 * 查询理赔附属列表
 * @param query
 * @returns {*}
 */

export const listAttach = (query?: AttachQuery): AxiosPromise<AttachVO[]> => {
  return request({
    url: '/system/attach/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询理赔附属详细
 * @param id
 */
export const getAttach = (id: string | number): AxiosPromise<AttachVO> => {
  return request({
    url: '/system/attach/' + id,
    method: 'get'
  });
};

/**
 * 新增理赔附属
 * @param data
 */
export const addAttach = (data: AttachForm) => {
  return request({
    url: '/system/attach',
    method: 'post',
    data: data
  });
};

/**
 * 修改理赔附属
 * @param data
 */
export const updateAttach = (data: AttachForm) => {
  return request({
    url: '/system/attach',
    method: 'put',
    data: data
  });
};

/**
 * 删除理赔附属
 * @param id
 */
export const delAttach = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/attach/' + id,
    method: 'delete'
  });
};
